<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/css.css" type="text/css"></link>
<style type="text/css">
input[type='text'] {
	background: none;
	text-align: center;
}

tr {
	text-align: center;
}
</style>
<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="../js/editboard.js"></script>
<title>编辑主题</title>
</head>
<body background="pic/ManBgroud.gif">
	<form method="post">
		<table cellspacing="0" cellpadding="20" border="1px">
			<tr>
				<th>编号</th>
				<th>主题</th>
				<th>操作</th>
			</tr>
			<c:forEach items="${sessionScope.boards}" var="bi">
			<tr>
				<td>${bi.bId}</td>
				<td><input name='bname' type='text' value='${bi.bName }' /></td>
				<td><input type='button' value='删除' name='del'></td>
			</tr>
			</c:forEach>
			<%--
	List<BoardInfo> lbi=(List<BoardInfo>)session.getAttribute("boards");
	for(BoardInfo bi:lbi){
		out.println("<tr><td>"+bi.getbId()+"</td><td><input name='bname' type='text' value='"+bi.getbName()+"' /></td><td><input type='button' value='删除' name='del'></td></tr>");
	}
--%>
			<tr>
				<td colspan="3"><input type="submit" value="保存修改" /></td>
			</tr>
		</table>
		<input type="hidden" name="isEditbid" />
	</form>
	
<script>
	var show="";
	<c:if test="${not empty sessionScope.isEditBoardSucc}">
		<c:if test="${fn:contains(sessionScope.isEditBoardSucc,'updatesucc')}"><%--包含 “updatesucc”--%>
			show+="修改操作成功！";
		</c:if>
		
		<c:if test="${fn:contains(sessionScope.isEditBoardSucc,'deltesucc')}">
			show+="删除操作成功！";
		</c:if>
		
		<c:if test="${fn:contains(sessionScope.isEditBoardSucc,'updatefail')}">
			show+="修改操作失败！";
		</c:if>
		
		<c:if test="${fn:contains(sessionScope.isEditBoardSucc,'delfail')}">
			show+="删除操作失败！";
		</c:if>	
		<c:set var="isEditBoardSucc" value="${null}" scope="session"/>
		alert(show);
	</c:if>
	
	<%--添加主题后跳转过来 --%>
	<c:if test="${sessionScope.addBoardSucc eq true}">
		<c:set var="addBoardSucc" value="${null}" scope="session"/>
		alert('添加成功！');
	</c:if>
	
	<c:if test="${sessionScope.addBoardSucc eq false}">
		<c:set var="addBoardSucc" value="${null}" scope="session"/>
		alert('添加失败！');
	</c:if>
	
</script>
</body>
<%--
	String isEditBoardSucc=(String)session.getAttribute("isEditBoardSucc");
	if(isEditBoardSucc!=null){
		session.setAttribute("isEditBoardSucc", null);//防止刷新时出问题
		String show="";
		if(isEditBoardSucc.indexOf("updatesucc")>=0){
			show+="修改操作成功！";
		}
		if(isEditBoardSucc.indexOf("deltesucc")>=0){
			show+="删除操作成功！";
		}
		if(isEditBoardSucc.indexOf("updatefail")>=0){
			show+="修改操作失败！";
		}
		if(isEditBoardSucc.indexOf("delfail")>=0){
			show+="删除操作失败！";
		}
		out.println("<script>alert('"+show+"');</script");
	}
	//添加主题后跳转过来
	Boolean addBoardSucc=(Boolean)session.getAttribute("addBoardSucc");
	if(addBoardSucc!=null){
		session.setAttribute("addBoardSucc", null);
		if(addBoardSucc.equals(true)){
			out.println("<script>alert('添加成功！');</script");
		}
		else{
			out.println("<script>alert('添加失败！');</script");
		}
	}

--%>
</html>

















